package com.lsy.weizhi2.popupwindow;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.View;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.lsy.weizhi2.R;
import com.lsy.weizhi2.mybase.BaseApp;
import com.lsy.weizhi2.myutils.DiaLogPopupCall;

/**
 * Created by 嗨哟 on 2017/3/18.
 */
public class DialogPopup {
    private static PopupWindow hintpopup;
    public static void ShowDialog(Context context, View parent, String title, String content, final DiaLogPopupCall diaLogPopupCall){
        View view=View.inflate(context, R.layout.hintpopup,null);
        TextView hint_title= (TextView) view.findViewById(R.id.hint_title);
        TextView hint_content= (TextView) view.findViewById(R.id.hint_content);
        hint_title.setText(title);
        hint_content.setText(content);
        hintpopup=new PopupWindow(context);
        hintpopup.setContentView(view);
        hintpopup.setWidth(BaseApp.SCREEN_WIDTH*400/750);
        hintpopup.setHeight(BaseApp.REAL_HEIGHT*200/1334);
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        hintpopup.setBackgroundDrawable(dw);
        hintpopup.setFocusable(true);
        hintpopup.showAtLocation(parent, Gravity.CENTER,0,0);
      /*  hintpopup.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                diaLogPopupCall.dismissListener();
            }
        });*/
    }
}
